package com.da.lon.wang.xlg.util;

import android.content.Context;

import com.da.lon.wang.xlg.view.LoadingDialog;

public class DialogUtil {
    private static LoadingDialog dialog;

    public DialogUtil(Context context) {
        dialog = new LoadingDialog(context);
        // dialogView =
        // LayoutInflater.from(context).inflate(R.layout.ocoffee_loading_dialog,
        // null);
        // dialogGifView = (GifView) dialogView.findViewById(R.id.loading_gif);
        // dialogGifView.setGifImage(R.drawable.gif);
        // dialogGifView.setGifImageType(GifImageType.COVER);
    }

    public static LoadingDialog getDialog() {
        return dialog;
    }

    public static void setDialog(LoadingDialog dialog) {
        DialogUtil.dialog = dialog;
    }

    public void dismissDialog() {
        if (dialog != null && dialog.isShowing()) {
            try {
                dialog.dismiss();
            } catch (Exception e) {

            }
        }
    }

    public void showDialog() {
        if (dialog != null && !dialog.isShowing()) {
            try {
                dialog.show();
            } catch (Exception e) {

            }
        }
    }

    // public void showDialog(CharSequence title) {
    // if (dialog == null) {
    // dialog = new Dialog(context, R.style.ocoffee_loading_dialog);
    // dialog.setCanceledOnTouchOutside(true);
    // dialog.setContentView(dialogView);
    // }
    // if (dialog != null && !dialog.isShowing()) {
    // dialog.show();
    // }
    // }
}
